HAL_DRIVER_SRC =  \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_can.c        \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_i2c.c        \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_lgpio.c        \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_misc.c        \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_p2m_udma.c        \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_pa2m_udma.c        \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_qspi.c        \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_adv_timer.c        \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_usart.c        \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_pmu.c        \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_iomux.c        \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_xec.c        \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_rtc.c        \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_wwdg.c             
        C_SOURCES += $(HAL_DRIVER_SRC)
#        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_gmc.c        \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Drivers/csg_xec.c        \


#        $(SDK_DIR)/drivers/third_party/GigaDevice/GD32VF103_standard_peripheral/Source/gd32vf103_i2c.c    \
         $(SDK_DIR)/drivers/third_party/GigaDevice/GD32VF103_standard_peripheral/Source/gd32vf103_fwdgt.c  \
        $(SDK_DIR)/drivers/third_party/GigaDevice/GD32VF103_standard_peripheral/Source/gd32vf103_pmu.c    \
        $(SDK_DIR)/drivers/third_party/GigaDevice/GD32VF103_standard_peripheral/Source/gd32vf103_rtc.c    \
        $(SDK_DIR)/drivers/third_party/GigaDevice/GD32VF103_standard_peripheral/Source/gd32vf103_spi.c    \
        $(SDK_DIR)/drivers/third_party/GigaDevice/GD32VF103_standard_peripheral/Source/gd32vf103_dma.c    \
        $(SDK_DIR)/drivers/third_party/GigaDevice/GD32VF103_standard_peripheral/Source/gd32vf103_adc.c    \
        $(SDK_DIR)/drivers/third_party/GigaDevice/GD32VF103_standard_peripheral/Source/gd32vf103_bkp.c    \
        $(SDK_DIR)/drivers/third_party/GigaDevice/GD32VF103_standard_peripheral/Source/gd32vf103_can.c    \
        $(SDK_DIR)/drivers/third_party/GigaDevice/GD32VF103_standard_peripheral/Source/gd32vf103_crc.c    \
        $(SDK_DIR)/drivers/third_party/GigaDevice/GD32VF103_standard_peripheral/Source/gd32vf103_dbg.c    \
                $(SDK_DIR)/drivers/third_party/GigaDevice/GD32VF103_standard_peripheral/Source/gd32vf103_fmc.c    \
        $(SDK_DIR)/drivers/third_party/GigaDevice/GD32VF103_standard_peripheral/Source/gd32vf103_dac.c    



TARGET_LIB_SRC = \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/clock_getres.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/clock_gettime.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/clock_settime.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/close.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/execve.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/exit.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/fork.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/fstat.c     \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/getpid.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/gettimeofday.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/isatty.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/kill.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/link.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/lseek.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/open.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/read.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/sbrk.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/times.c      \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs/write.c
        C_SOURCES += $(TARGET_LIB_SRC)

        #$(SDK_DIR)/targets/GD32VF103V_EVAL/Lib/_exit.c      \

USER_SRC = $(SDK_DIR)/targets/HBIRD_EVAL/Src/main.c \
        $(SDK_DIR)/targets/HBIRD_EVAL/Src/net_driver.c \
        $(SDK_DIR)/targets/HBIRD_EVAL/Src/logs.c \
        $(SDK_DIR)/targets/HBIRD_EVAL/Src/eth.c \
        $(SDK_DIR)/iot_link/fatfs/diskio.c \
        $(SDK_DIR)/iot_link/fatfs/pcram.c \
        $(SDK_DIR)/targets/HBIRD_EVAL/Src/pca9555.c      \
        $(SDK_DIR)/targets/HBIRD_EVAL/Src/myiic.c       \
        $(SDK_DIR)/targets/HBIRD_EVAL/Src/rx8803.c       \
        $(SDK_DIR)/iot_link/fatfs/onchip_flash.c \
        $(SDK_DIR)/iot_link/fatfs/ff.c \
        $(SDK_DIR)/iot_link/os/os_imp/liteos/extended/tickless/los_tickless.c
        C_SOURCES += $(USER_SRC)
        
HANDLERS_SRC =  \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/csg_common.c \
        $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/system_csg.c
        C_SOURCES += $(HANDLERS_SRC)
        # $(SDK_DIR)/targets/GD32VF103V_EVAL/GCC/handlers.c \
        # $(SDK_DIR)/targets/GD32VF103V_EVAL/GCC/init.c
        
OS_CONFIG_INC = \
        -I $(SDK_DIR)/targets/HBIRD_EVAL/OS_CONFIG
        C_INCLUDES += $(OS_CONFIG_INC)       
# C includes
HAL_DRIVER_INC = \
        -I $(SDK_DIR)/drivers/third_party/Hbird/NMSIS-zx/Core/Include \
        -I $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Board/mcu200t_eval/Include \
        -I $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Include \
        -I $(SDK_DIR)/targets/HBIRD_EVAL/Src \
        -I $(SDK_DIR)/iot_link/fatfs \
        -I $(SDK_DIR)/iot_link/os/os_imp/liteos/extended/tickless \
        -I $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs
        C_INCLUDES += $(HAL_DRIVER_INC)

# ifeq ($(CONFIG_AT_ENABLE),y)
#     UART_AT_SRC = $(TOP_DIR)/targets/GD32VF103V_EVAL/uart_at/uart_at.c
#     C_SOURCES += $(UART_AT_SRC)
# endif

        
RISCV_ASM_INC = \
        -I $(SDK_DIR)/drivers/third_party/Hbird/NMSIS-zx/Core/Include \
        -I $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Board/mcu200t_eval/Include \
        -I $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Include \
        -I $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/Stubs
        AS_INCLUDES += $(RISCV_ASM_INC)

USER_INC = 
        # -I $(SDK_DIR)/targets/GD32VF103V_EVAL/Inc
        C_INCLUDES += $(USER_INC)

ASM_SOURCES_S += $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/GCC/intexc_csg.S \
                 $(SDK_DIR)/drivers/third_party/Hbird/SoC/zx/Common/Source/GCC/startup_csg.S
        
# C defines
# C_DEFS += -D NDEBUG -DUSE_STDPERIPH_DRIVER -DGD32V103V_EVAL
C_DEFS += -DDOWNLOAD_MODE=DOWNLOAD_MODE_ILM -DNUCLEI_BANNER=0
AS_DEFS += -DDOWNLOAD_MODE=DOWNLOAD_MODE_ILM -DNUCLEI_BANNER=0

include $(SDK_DIR)/iot_link/iot.mk
include $(SDK_DIR)/demos/kernel_demo/kernel_demo.mk
# include $(SDK_DIR)/demos/task20_demo/task20_demo.mk
